package cz.czu.pef.DataModelling.domainObjects;

import java.util.*;

public class RoleType extends CommonObjectImpl implements IdObject
{
  private static final long serialVersionUID = -2229283611120061286L;

  /*
	 * Entity attributes (some inherited).
	 */

  /*
	 * Relations
	 */
	/**
	 * Relation to Role instances created with this RoleType
	 */
	//@OnDelete(action=OnDeleteAction.NO_ACTION)
	private Set<Role> roles;

	/**
	 * Required medical examination which person must pass in order to fulfill this RoleType's requirements
	 */
	private Set<MedicalExaminationTypeForRoleType> medExamTypesForRoleTypes;

	/**
	 * Required trainings which person must pass in order to fulfill this RoleType's requirements
	 */
	private Set<TrainingTypeForRoleType> traningTypesForRoleTypes;


	public RoleType()
	{
		super(null, null, null);
	}

	public RoleType(String roleCode, String roleName, String roleDescription)
	{
		super(roleCode, roleName, roleDescription);
	}

	public Set<Role> getRoles()
	{
		return roles;
	}

	public List<Role> getRolesAsList()
	{
		return new ArrayList<Role>(getRoles());
	}

	public Set<MedicalExaminationTypeForRoleType> getMedicalExaminationTypeForRoleType()
	{
		return medExamTypesForRoleTypes;
	}

	public List<MedicalExaminationTypeForRoleType> getMedicalExaminationTypeForRoleTypeAsList()
	{
		return new ArrayList<MedicalExaminationTypeForRoleType>(getMedicalExaminationTypeForRoleType());
	}

	public void addMedicalExaminationTypeForRoleType(MedicalExaminationTypeForRoleType medicalExaminationTypeForRoleType)
	{
		if (this.medExamTypesForRoleTypes == null)
			this.medExamTypesForRoleTypes = new HashSet<MedicalExaminationTypeForRoleType>();
		this.medExamTypesForRoleTypes.add(medicalExaminationTypeForRoleType);
	}

	public Set<TrainingTypeForRoleType> getTraningTypesForRoleTypes()
	{
		return traningTypesForRoleTypes;
	}

	public List<TrainingTypeForRoleType> getTraningTypesForRoleTypesAsList()
	{
		return new ArrayList<TrainingTypeForRoleType>(getTraningTypesForRoleTypes());
	}

	public void addTrainingTypeForRoleType(TrainingTypeForRoleType traningTypesForRoleType)
	{
		if (this.traningTypesForRoleTypes == null)
			this.traningTypesForRoleTypes = new HashSet<TrainingTypeForRoleType>();
		this.traningTypesForRoleTypes.add(traningTypesForRoleType);
	}

	
  public Set<MedicalExaminationTypeForRoleType> getMedExamTypesForRoleTypes()
  {
    return medExamTypesForRoleTypes;
  }

  
  public void setMedExamTypesForRoleTypes(Set<MedicalExaminationTypeForRoleType> medExamTypesForRoleTypes)
  {
    this.medExamTypesForRoleTypes = medExamTypesForRoleTypes;
  }

  
  public void setRoles(Set<Role> roles)
  {
    this.roles = roles;
  }

  
  public void setTraningTypesForRoleTypes(Set<TrainingTypeForRoleType> traningTypesForRoleTypes)
  {
    this.traningTypesForRoleTypes = traningTypesForRoleTypes;
  }

  public String toString()
	{
		StringBuilder builder = new StringBuilder();
		builder.append("RoleType [toString()=");
		builder.append(super.toString());
		builder.append("]");
		return builder.toString();
	}
}
